<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\UserPromoteRecord;

class UserPromoteRecordController extends Controller
{
    public function record(Request $request)
    {
        $promote_records = UserPromoteRecord::where('user_id', \Auth::id())->orderBy('created_at', 'desc')->paginate('10');

        if ($request->ajax()) {
            $view = view('mobile.layouts._promote-record-item',compact('promote_records'))->render();
            return response()->json(['html'=>$view]);
        }

        return view('mobile.user.promote_credit_record', compact('promote_records'));
    }
}
